$(function () {
  let form = layui.form;
  let layer = layui.layer;
  form.verify({
    same: function (value) {
      var uname = $(".layui-form input[name=password]").val();
      if (value !== uname) {
        return "两次输入的密码不一样";
      }
    },
  });

  // 提交添加的用户信息
  $(".layui-form").on("submit", function (e) {
    e.preventDefault();
    let fd = $(this).serialize();
    $.ajax({
      type: "post",
      url: "admin/users",
      data: fd,
      success: function (res) {
        layer.msg(res.message);
      },
    });
  });
});
